package com.yungu.swift.assets.utils;

import com.yungu.swift.assets.driver.model.dto.DriverCheckDto;
import com.yungu.swift.assets.driver.model.dto.DriverDto;
import com.yungu.swift.common.service.CommonSmsService;

/**
 * Created by cuixiuyin on 2018/8/20.
 * 在此类管理所有短信发送，便于维护
 */
public class SendMessageUtils {

    /**
     * 司机审核通过时发送的短信
     */
    public static void driverPassSend(CommonSmsService commonSmsService, DriverCheckDto dto, DriverDto driverDto) {
        String msg = "司机审核通过：" + driverDto.getName() + "师傅，恭喜您的司机注册审核通过了，现在登录app即可接单，账号：" + driverDto.getMobile() + "，初始密码：123456";
        commonSmsService.sendCommon(dto.getMobile(), msg, dto.getAppid());
    }

    /**
     * 司机审核不通过时发送的短信
     */
    public static void driverRejectSend(CommonSmsService commonSmsService, DriverCheckDto dto, String remark) {
        String msg = dto.getName() + "师傅，您的司机注册审核失败，原因：" + remark + "，您可打开app查看详情并重新提交申请";
        commonSmsService.sendCommon(dto.getMobile(), msg, dto.getAppid());
    }

    /**
     * 司机新增通过时发送的短信
     */
    public static void driverAddSend(CommonSmsService commonSmsService, DriverDto driverDto, String serviceTel) {
        StringBuilder sBuilder = new StringBuilder();
        sBuilder.append("恭喜您，您的司机账号已生成，账号：").append(driverDto.getMobile()).append("，初始密码：123456；待完善资料后即可接单");
        sBuilder.append("，详情可致电：");
        sBuilder.append(serviceTel);
        commonSmsService.sendCommon(driverDto.getMobile(), sBuilder.toString(), driverDto.getAppid());
    }

    /**
     * 绑定车辆时候绑定的发送
     *
     * @param commonSmsService
     * @param mobile
     * @param appid
     */
    public static void bingCarSend(CommonSmsService commonSmsService, String mobile, String appid) {
        commonSmsService.sendCommon(mobile, "恭喜您，您的司机账号已成功绑定车辆，登录账号即可接单。", appid);
    }

    /**
     * 车辆解绑短信发送
     *
     * @param commonSmsService
     * @param mobile
     * @param appid
     */
    public static void unBingCarSend(CommonSmsService commonSmsService, String mobile, String appid) {
        commonSmsService.sendCommon(mobile, "您的车辆信息已跟账号解绑，详情请咨询客服", appid);
    }
}
